#include <ros/ros.h>
#include <sstream>
#include "ros_test_pkg/myMsg.h"


int main(int argc,char **argv)
{
    std::string param_name;
    int param_id;
    float param_percent;

    ros::init(argc,argv,"topic_publisher");
    ros::NodeHandle node_handle;

    ros::Publisher pub_number = node_handle.advertise<ros_test_pkg::myMsg>("/count",10);

    ros::param::get("~name",param_name);
    ros::param::get("~id",param_id);
    ros::param::get("~percent",param_percent);
    ROS_WARN("name:%s,id:%d,percent:%f",param_name.c_str(),param_id,param_percent);

    ros::Rate rate(1);
    int number_count=0;
    while(ros::ok())
    {
        ros_test_pkg::myMsg msg;
        msg.name = param_name;
        msg.device_id = param_id;
        msg.percent = param_percent;

        pub_number.publish(msg);

        ros::spinOnce();
        rate.sleep();
        number_count++;
    }

    return 0;
}
